/*
 * Copyright (c) 2012, Marcin Czekaj
 * All rights reserved.
 *
 * This software is open-source under the BSD license; see LICENSE.TXT for a description.
 */
package pl.edu.uj.fais.graph.io;

import java.util.HashMap;
import java.util.Map;

import pl.edu.uj.fais.graph.elements.Node;

public class NodeFactory {
    
    private Map<String, Node> nodes = new HashMap<>();
    
    public Node newNode() {
        return new Node();
    }
    
    public Node getNode(String id) {
        if (nodes.containsKey(id)) {
            return nodes.get(id);
        } else {
            Node node = new Node();
            nodes.put(id, node);
            return node;
        }
    }
}
